<?php
session_start();
// 获取登录的id
$uid = $_SESSION['uid'];
if(isset($uid)){
    // logined
    $conn = mysqli_connect('127.0.0.1','root','123456','super','3306');
// 2.设置查询编码 ***重要
   mysqli_query($conn,'SET NAMES UTF8');
   // 查询id为1的项目
   $sql = "SELECT p.p_name,p.id FROM project_user as pu left join project as p on pu.pid=p.id WHERE pu.uid=$uid";
   $result = mysqli_query($conn,$sql);
   $data = [];
   while ($d = mysqli_fetch_array($result)) {
       array_push($data, $d);
   }

}else{
    header('location:login.php');
}

?>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>project</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/project.css">
</head>
<body>
<div>
    <header></header>
    <div class="content">
        <nav>
            <p><img src="../images/add.png" alt=""><span>新建项目</span></p>
        </nav>
        
        <div id="content">

             <?php foreach ($data as $d) { ?>
            <a href="task.php?id=<?php echo($d['id']) ?>">
                <span><img src="../images/colock.png" alt=""></span>
                <span id='<?php echo($d['id'])  ?>' name='id' method='get'><?php echo($d['p_name']) ?></span>
               
            </a>
             <?php } ?> 
        </div>
       
    </div>

    <div id="ncontent">
        <div id="nav">19-洛阳理工学院H5所有项目</div>
        <div id="creat">
            <h2>创建行项目</h2>
            <p id="proname"><input name='p_name' type="text" placeholder="项目名称" id="inp"></p>
            <p id="error"></p>
            <textarea name='p_detail' type='text' placeholder="简单描述项目，便于其他人理解"cols="50" rows="10"></textarea>
            <div class="teams">
              
            </div>
            


            <p id="bottom">
                <span id="creatBtn"><a href="#"><input type='submit' value='创建项目'></a></span>
                <a  href="#">取消</a>
            </p>
        </div>
    </div>

</div>

<input type="hidden" id="p_id" value="<?php echo $_GET['id'] ?>">
<script src="../js/jquery-3.1.1.js"></script>
<script src="../js/common.js"></script>
<script src="../js/project.js"></script>
</body>
</html>